package com.dmap.analysispoint.utils;

import com.dmap.analysispoint.bo.NameAndValueBo;

import java.util.List;

public class VersionUtils {

    /**
     *对获取的手机版本状态信息转化为android和ios两类
     */
    public static List<NameAndValueBo> getPhoneVersion(List<NameAndValueBo> nameAndValueBoList) {

        for (NameAndValueBo phoneVersionBo: nameAndValueBoList) {
            if (phoneVersionBo.getName().equals("1")) {
                phoneVersionBo.setName("android");
            }else {
                phoneVersionBo.setName("ios");
            }
        }
        return nameAndValueBoList;
    }

    /**
     *对获取的手机版本信息转化为android和ios两类，1android为，2为ios
     */
    public static Integer setPhoneVersion(String phoneVersion) {

        int success;
        String param = phoneVersion.substring(0,1);
        if (param.equalsIgnoreCase("a")) {
            success = 1;
        }else {
            success = 2;
        }
        return success;
    }

    public static String setFirmwareVersion(String firmwareVersion) {

        String success;
        String param = firmwareVersion.substring(0,1);
        if (param.equalsIgnoreCase("v")) {
            firmwareVersion = firmwareVersion.substring(1);
            success = firmwareVersion;
        }else {
            success = firmwareVersion;
        }
        return success;
    }
}
